/*************************************************************************
	> File Name: unionset.h
	> Author: Wang Bo
	> Mail: 1276106221@qq.com
	> Created Time: 2020年12月03日 星期四 23时46分15秒
 ************************************************************************/

#ifndef _UNIONSET_H
#define _UNIONSET_H

#define swap(a, b) {\
    __typeof(a) __temp = a;\
    a = b, b = __temp;\
}

typedef struct _unionset {
    int size;
    int *father;
    int *childs;
} UnionSet;

UnionSet *initUnionSet(int);
int merge(UnionSet *, int, int);
int find(UnionSet *, int);
void clearUnionSet(UnionSet *);

#endif
